package com.jjb.www.ui.adapter;

import android.content.Context;
import android.view.ViewGroup;

import androidx.annotation.NonNull;

import com.hjq.shape.layout.ShapeLinearLayout;
import com.hjq.shape.view.ShapeTextView;
import com.jjb.www.R;
import com.jjb.www.app.AppAdapter;
import com.jjb.www.http.api.LiveDingApi;

/**
 *    author : Android CRG
 *    time   : 2018/11/05
 *    desc   : 可进行拷贝的副本
 */
public final class LiveRecordingAdapter extends AppAdapter<LiveDingApi.Bean.DataDTO> {

    public LiveRecordingAdapter(Context context) {
        super(context);
    }

    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new ViewHolder();
    }

    private final class ViewHolder extends AppAdapter<?>.ViewHolder {
        private ShapeTextView mTvTitle;
        private ShapeTextView mTvLock;
        private ShapeTextView mTvTg;
        private ShapeLinearLayout mLlView;
        private ShapeTextView mTvNowTime;
        private ShapeTextView mTvTotalTime;



        private ViewHolder() {
            super(R.layout.item_live_recording);
            mTvTitle = findViewById(R.id.tv_title);
            mTvLock = findViewById(R.id.tv_lock);
            mTvTg = findViewById(R.id.tv_tg);
            mLlView = findViewById(R.id.ll_view);
            mTvNowTime = findViewById(R.id.tv_now_time);
            mTvTotalTime = findViewById(R.id.tv_total_time);
        }

        @Override
        public void onBindView(int position) {
            LiveDingApi.Bean.DataDTO bean = getItem(position);
            mTvTitle.setText("直播课程"+bean.getSectionName());
            if (bean.getCountDuration()==0){
                mTvNowTime.setText("生成中");
            }
            if (bean.getDuration()==0){
                mTvTotalTime.setText("生成中");
            }
        }
    }
}